package seven.test_7_19;

import java.util.Scanner;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        scanner.nextLine();
        String str = scanner.nextLine();
        int s = 0;
        int h = 0;
        int i = 0;
        int n = 0;
        int count = 0;
        for (int j = 0; j < str.length(); j++) {
            char c = str.charAt(i);
            if (c == 's') {
                s++;
            }
            if (c == 'h') {
                h++;
            }
            if (c == 'i') {
                i++;
            }
            if (c == 'n') {
                n++;
            }
            if (c == 'y' && s != 0 && h != 0) {
                count += (s * h);
                count += (s * h * i * n);
            }
        }
        System.out.println(count);
    }
}
